﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using BookFlightServices.Models;
using TongHopBookFlightDAO;
using TongHopBookFlightDAO.DAO;

namespace BookFlightServices.Controllers
{
    public class DiaDiemController : ApiController
    {
        // GET api/diadiem
        public List<MDiaDiem> Get()
        {
            List<DiaDiem> dsDiaDiems = DiaDiemDAO.GetAll();

            List<MDiaDiem> lstResults = new List<MDiaDiem>();
            foreach (DiaDiem item in dsDiaDiems)
            {
                MDiaDiem mDiaDiem = new MDiaDiem();

                mDiaDiem.DiaDiemID = item.DiaDiemID;
                mDiaDiem.MaDiaDiem = item.MaDiaDiem;
                mDiaDiem.TenDiaDiem = item.TenDiaDiem;
                mDiaDiem.KhuVuc = item.KhuVuc;

                lstResults.Add(mDiaDiem);
            }

            return lstResults;
        }

        // GET api/diadiem/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/diadiem
        public void Post([FromBody]string value)
        {
        }

        // PUT api/diadiem/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/diadiem/5
        public void Delete(int id)
        {
        }
    }
}
